package edu.cuit.avatar.think;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/5 9:13
 */
public class BMI {
    private float height;
    private float weight;
    private String name;

    public BMI(float height, float weight) {
        this.height = height;
        this.weight = weight;
    }

    public BMI(float height, float weight, String name) {
        this(height, weight);
        this.name = name;
    }

    public float getHeight() {
        return height;
    }

    public void setHeight(float height) {
        this.height = height;
    }

    public float getWeight() {
        return weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getBMI() {
        return weight / (height * height);
    }

    public String getState() {
        double bmi = getBMI();
        if(bmi < 18.5) return "偏瘦";
        else if(bmi >= 18.5 && bmi < 25) return "正常";
        else if(bmi >= 25 && bmi < 30) return "偏胖";
        else return "过胖";
    }
}
